﻿using Coldairarrow.Entity.DTO;
using Coldairarrow.Entity.ListSelection;
using Coldairarrow.Entity.PB;
using Coldairarrow.Util;
using Coldairarrow.Util.ClassLibrary;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;

namespace Coldairarrow.Business.PB
{
    public partial interface IPB_DesignListBusiness
    {
        Task<PageResult<PB_DesignListBulidingDTO>> GetDataListAsync(PageInput<ConditionDTO> input);
        Task<List<BuildingnumberDTO>> GetBuildingnumberDataListAsync(string projectId);
        Task<PageResult<PB_DesignListBulidingDTO>> GetDataListItemAsync(PageInput<ConditionDTO> input);
        Task<PB_Material> GetProductCodeData(String ProductCode);
        Task<AjaxResult> GetallCount(string ProjectId, string Buid, int Type);
        Task<PB_DesignList> GetTheDataAsync(string id);
        //Task <List<PB_DesignListDto>> GetDesignListJson(string ParentId);
        Task<List<DataTypeInfo>> GetDataLisJson(string id);
        Task AddDataAsync(PB_DesignList data);
        Task AddDataExlAsync(List<PB_DesignList> list);
        Task UpdateDataAsync(PB_DesignList data);
        Task<AjaxResult> DeleteDataAsync(List<string> ids);
        Task AddData(PB_DesignDTO data);
        Task MaintenanceSteps(PB_designDetaliList data, string Parentid);
        Task<AjaxResult> GetDesignPiakMain(string Id);
        Task AddMaterialData(SaveMaterialData data);
        Task UpdateMaterialData(SaveMaterialData data);
        IQueryable<T> GetQueryableOK<T>() where T : class, new();
        Task UpdateData(PB_DesignDTO data);
        Task UpdateData(List<PB_DesignDetail> data);
        //Task UpdateDataList(PB_DesignDTO data);
        Task<List<DataTypeDTO>> GetTypeAsyncs(string ParentId);
        Task<PageResult<PB_MaterialSelectDTO>> GetDataSelectListAsync(PageInput<ConditionDTO> input, string ParentId);
        IQueryable<T> GetQueryable<T>() where T : class, new();
        Task<PageResult<PB_DesignList>> GetDataSelectAsync(PageInput<DesignListConditionDTO> input);
        //Task<TypeDto> GetTypeAsync(string MaterialTypeId);//根据物料类型返回物料信息
        Task<List<ListSelectionDto>> GetListSelection(SSS data);
        /// <summary>
        /// 清单审核列表
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        Task<PageResult<PB_DesignList>> GetDataListToExamineAsync(PageInput<ConditionDTO> input);

        /// <summary>
        /// 审核
        /// </summary>
        /// <param name="id">清单ID</param>
        /// <param name="stateType">状态</param>
        /// <returns></returns>
        Task ToExamineDataAsync(string id, int stateType);

        /// <summary>
        /// 清单变更
        /// </summary>
        /// <param name="id">清单ID</param>
        /// <returns></returns>
        Task UpdateDesignListDataChangeAsync(string id);

        /// <summary>
        /// 获取版本信息
        /// </summary>
        /// <param name="id">清单ID</param>
        /// <returns></returns>
        PB_DesignListVersion GetDesignListVersionAsync(string id);

        /// <summary>
        /// 清单提交审核
        /// </summary>
        /// <param name="Id">清单Id</param>
        /// <returns></returns>
        Task UpdateDataStateAsync(string Id);

        /// <summary>
        /// 获取设计清单明细是成品的物料
        /// </summary>
        /// <param name="designId">设计清单Id</param>
        /// <returns></returns>
        Task<List<PB_DesignListDataDTO>> GetDesignDetailPrintListAsync(string designId);

        /// <summary>
        /// 设计清单成品物料打印
        /// </summary>
        /// <param name="input">设计清单id+打印集合</param>
        /// <param name="_mongodbOptions">设计清单Id</param>
        /// <param name="_redisOptions">设计清单Id</param>
        /// <returns></returns>
        Task PrintDesignDetailListAsync(MaterialNumDTO input, MongoDBOptions _mongodbOptions, RedisOptions _redisOptions);

        /// <summary>
        /// 设计清单成品物料明细
        /// </summary>
        /// <param name="designdetailId">设计清单明细Id</param>
        /// <returns></returns>
        Task<List<PB_JobBookingQrCodeDTO>> GetDesignDetailJobBookingQrCodeAsync(string designdetailId);

        /// <summary>
        /// 设计清单成品物料补打
        /// </summary>
        /// <param name="data"></param>
        /// <param name="_mongodbOptions">设计清单Id</param>
        /// <returns></returns>
        Task PrintDesignDetailJobBookingQrCodeAsync(PB_DesignDetailPrintDataDTO data, MongoDBOptions _mongodbOptions);

        /// <summary>
        /// 获取设计清单信息
        /// </summary>
        /// <param name="id">设计清单Id</param>
        /// <param name="deatiltype">1设计清单明细；2、设计清单明细汇总</param>
        /// <returns></returns>
        Task<DesignListDataDTO> GetDesignListDataAsync(string id, int deatiltype);


        Task<PB_DesignListPrint> GetDataListPrint(string ParentId);

        /// <summary>
        /// 获取设计清单类型
        /// </summary>
        /// <returns></returns>
        Task<List<PB_DesignListType>> GetDesignListTypeListAsync();
        /// <summary>
        /// 补加单导入推送工作流
        /// </summary>
        /// <param name="DesigId"></param>
        /// <returns></returns>
        Task GetOverFlowMessage(string DesigId);
        /// <summary>
        /// 导入变更单推送工作流审批
        /// </summary>
        /// <param name="DesigId"></param>
        /// <returns></returns>
        Task PushChangMessage(string DesigId);
        /// <summary>
        /// 设计清单导入推送
        /// </summary>
        /// <param name="DesigId"></param>
        /// <returns></returns>
        Task GetOverFlowAdd(string DesigId);
        /// <summary>
        /// 导入设计清单修改状态
        /// </summary>
        /// <param name="DesigId"></param>
        /// <returns></returns>
        Task updatastate(string DesigId);

        Task<string> GetFileAddress(string DesigId, string Type);

        Task DesignListDelete(DesignListDelete data);
    }

    public class DesignListConditionDTO
    {
        public string Condition { get; set; }
        public string Keyword { get; set; }

        public int? Type { get; set; }
    }

    public class DesignListDelete {
        /// <summary>
        /// 清单Id
        /// </summary>
        public string DesignId { get; set; }
        /// <summary>
        /// 基础数量
        /// </summary>
        public double? BasicQuantity { get; set; }
        /// <summary>
        /// 补加数量
        /// </summary>
        public double? SupplementaryQuantity { get; set; }

        /// <summary>
        /// 变更数量
        /// </summary>
        public double? ChangeQuantity { get; set; }
    }
}